

export function firstToUpper(str = '') {
  return str.slice(0, 1).toUpperCase() + str.slice(1)
}
export function resetSortQuery(column,) {
  const { property } = column
  this.$set(this.queryParams, 'sort' + firstToUpper(property), null)
  this.getList()
}
export function setSortQuery(column, value) {
  const { property } = column
  Object.keys(this.queryParams).forEach((key) => {
    if (key.startsWith('sort')) {
      this.queryParams[key] = ''
    }
  })
  this.$set(this.queryParams, 'sort' + firstToUpper(property), value)
  this.$set(this.queryParams, 'sortSearchName', property)
  this.$set(this.queryParams, 'sortSearchType', value)
  console.log(`this.queryParams ==>`, JSON.parse(JSON.stringify(this.queryParams)))
  this.getList()
}
export function setSortIconStyle(column, value) {
  const { property } = column
  const key = 'sort' + firstToUpper(property)
  const type = this.queryParams[key]
  let color = '#c0c4cc'
  if (type == value) {
    color = '#1890ff'
  }
  return {
    color,
  }
}
